{include file="public/header" /}
<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5>审核活动</h5>
                    <div class="ibox-tools">
                        <a class="collapse-link">
                            <i class="fa fa-chevron-up"></i>
                        </a>
                    </div>
                </div>
                <div class="ibox-content">
                    <form class="form-horizontal m-t" name="add_article" id="add_article" enctype="multipart/form-data">
                        <input type="hidden" name="id" value="{$res['id']}">
                        <div class="form-group">
                            <label class="col-sm-3 control-label">标题：</label>
                            <div class="input-group col-sm-4">
                                <input id="title" disabled type="text" class="form-control"value="{$res.activity_name?$res.activity_name:''}">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">活动标签：</label>
                            <div class="input-group col-sm-4">
                                <input  type="text" disabled class="form-control" value="{$res.name?$res.name:''}">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">详情地址：</label>
                            <div class="input-group col-sm-4">
                                <input  type="text" disabled class="form-control"value="{$res.activity_address?$res.activity_address:''}">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">发布机构：</label>
                            <div class="input-group col-sm-4">
                                <input id="" type="text" disabled class="form-control"value="{$res.mechanism_name?$res.mechanism_name:''}">
                            </div>
                        </div>
                        <div class="form-group">
                        <label class="col-sm-3 control-label">公益时长：</label>
                        <div class="input-group col-sm-4">
                            <input id="" type="text" disabled class="form-control"value="{$res.activity_time?$res.activity_time:''}">
                        </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">活动报名时间：</label>
                            <div class="input-group col-sm-4">
                                <input type="text"  disabled name="start" value="{$res['activity_sign_start']?$res['activity_sign_start']:''}"onclick="laydate({istime: true,format: 'YYYY-MM-DD hh:mm'})" class="form-control layer-date search start" placeholder="开始日期" />
                                <span class="input-group-addon">到</span>
                                <input type="text"  disabled name="end"  value="{$res['activity_sign_end']?$res['activity_sign_end']:''}" onclick="laydate({istime: true,format: 'YYYY-MM-DD hh:mm'})"  class="form-control layer-date search end" placeholder="结束日期" />
                            </div>
                        </div>

                        <div class="form-group">
                            <label class="col-sm-3 control-label">活动开始时间：</label>
                            <div class="input-group col-sm-4">
                                <input type="text" disabled  name="startTime" value="{$res['activity_start_time']?$res['activity_start_time']:''}"  onclick="laydate({istime: true,format: 'YYYY-MM-DD hh:mm'})" class="form-control layer-date search startTime" placeholder="开始日期" />
                                <span class="input-group-addon">到</span>
                                <input type="text"  disabled name="endTime" value="{$res['activity_end_time']?$res['activity_end_time']:''}"  onclick="laydate({istime: true,format: 'YYYY-MM-DD hh:mm'})"  class="form-control layer-date search endTime" placeholder="结束日期" />
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">发布时间：</label>
                            <div class="input-group col-sm-4">
                                <input type="text" disabled class="form-control"value="{$res.create_time?$res.create_time:''}">
                            </div>
                         </div>
                        <div class="form-group" id="MyContent">
                            <label class="col-sm-3 control-label cyanse" for="myEditor">内容：</label>
                            <div class="input-group col-sm-9">
                                <textarea  disabled style="width:90%" id="myEditor">
                                <?php echo(html_entity_decode($res['activity_content']?$res['activity_content']:''))?>
                                </textarea>
                                <a id="myEditors" style="color:#A94543"></a>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label" for="myEditor">审核状态：</label>
                            <div class="input-group col-sm-9">
                                <div class="radio">
                                    <input type="radio" name="radio1" class="radio1" id="radio1" value="1" checked="">
                                    <label for="radio1">
                                        通过
                                    </label>
                                </div>
                                    <div class="radio">
                                        <input type="radio" class="radio1" name="radio1" id="radio2" value="2">
                                        <label for="radio2">
                                            驳回
                                        </label>
                                    </div>
                            </div>
                        </div>
                        <div class="form-group" id="content" style="display:none">
                            <label class="col-sm-3 control-label" for="myEditor">驳回原因：</label>
                            <div class="input-group col-sm-9 " >
                                <textarea name="content" class="content" style="width:660px;height:190px"></textarea>
                            </div>
                        </div>
                        <div class="form-group">
                            <div class="col-sm-4 col-sm-offset-3">
                                <button class="btn btn-primary btsave"  type="button"><i class="fa fa-save"></i> 保存</button>&nbsp;&nbsp;&nbsp;
                                <a class="btn btn-danger" href="javascript:history.go(-1);"><i class="fa fa-close"></i> 返回</a>
                            </div>
                        </div>
            </form>
        </div>
    </div>

</div>
</div>
</div>
{include file="public/footer" /}
<script type="text/javascript">
    //百度富文本编辑器
    var editor = UE.getEditor('myEditor', {
        initialFrameHeight:450,
        autoHeight: false,
        autoHeightEnabled:false,
        autoFloatEnabled:false
    });
</script>
<script>
    $(".radio1").on('click',function () {
        var checked_radio = $('input:radio[name="radio1"]:checked').val();
        if(checked_radio==1){
            $("#content").hide()
        }else{
            $("#content").show();
        }
    })

    $(".btsave").on('click',function () {
        text_content = $.trim($(".content").val());

        var checked_radio = $('input:radio[name="radio1"]:checked').val();
        if(checked_radio==2){
            if(text_content.length < 2){
                layer.msg("驳回原因不能为空", {icon: 1, time: 1500, shade: 0.1}, function (index) {
                });
                return false;
            }
        }
        $.ajax({
            url: "{:url('examine')}",
            type: "post",
            dataType:'json',
            data: $("#add_article").serialize(),
            success: function (data) {
                if (data.code == 200) {
                    wk.success(data.msg,1,"{:url('activity/index')}");
                } else if(data.code == 100){
                    $('.btn').removeAttr('disabled');
                    wk.error(data.msg,2,'');
                    return false;
                }
            }
        });
    })
</script>
</body>
</html>